home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
maximus
/
maxfreq2.zip
/
THISTIME.ZIP
/
THISTIME.DOC
< prev
Wrap
Text File
|
1991-09-06
|
4KB
|
108 lines
─────────────────────────────────────────────────────────────────────────────
THISTIME.COM
Utility to execute a BATch command line only once every "X" times.
─────────────────────────────────────────────────────────────────────────────
As with most inventions, this utility was born out of necessity!
I blew-away several files because my FAT table got screwed up.
If I had run CHKDSK more often I would probably have caught the problem
MUCH SOONER. Soooo, I added CHKDSK to my AUTOEXEC.BAT .... But ...
arrrrrgh! .... I couldn't STAND waiting for CHKDSK to finish it's job
EVERY TIME I BOOTED!
Sooooooo, I wrote a little utility which I've included in my AUTOEXEC.BAT.
It tracks the number of times a process HASN't been run, and then, when
the quantity of times passed reaches a predetermined threshold,
THEN THE PROGRAM IS RUN!
That means now my AUTOEXEC only runs CHKDSK once every 10 times I reboot ...
This ability to only run a Batch command line once every "X" times may
be applied to any batch activity.
─────────────────────────────────────────────────────────────────────────────
To see a sample of how the utility runs ....
■ Execute TESTTHIS.BAT
■ Keep pressing the enter key
■ Every THIRD time through the BATch file it will print a
different message
─────────────────────────────────────────────────────────────────────────────
How it works ...
■ The program THISTIME.COM accepts two parameters
■ The first parameter is a CYCLE IDENTIFIER - meaning, this is
a word that is used to identify this particular cycle
■ The second parameter is a THRESHOLD COUNTER - this is the
quantity of times that the command should be ignored.
■ Add a line to your batch file
THISTIME IDENTIFIER COUNTER
■ The utility will examine it's records and determine if this
pass is the X'th pass. For example: if COUNTER is set to
5 and this is the 5th time THISTIME.COM has been run, then the
counter stored in THISTIME's data file is reset to 1.
When the correct number of passes have been executed, THISTIME
will set ERRORLEVEL 1 .
■ If ERRORLEVEL 1 is set, your batch file should take appropriate
action.
─────────────────────────────────────────────────────────────────────────────
What THISTIME needs & uses ....
■ The utility automatically creates a file called THISTIME.DAT.
■ THISTIME.DAT is used to store the current counters for each
separate Cycle Identifier. There is no theoretical limit to the
number of cycle identifiers which may be maintained.
■ The DAT file is a simple text file which may be edited using
almost any text editor so long as the editor is capable of
non-document mode or some similar activity which doesn't alter
the text's high-byte.
■ The DAT file is created on the SAME DRIVE and SUBDIRECTORY
where the program THISTIME.DAT is stored. So long as your PATH
is pointing to where the program THISTIME.COM is stored then
the program is capable of finding the THISTIME.DAT data file.
─────────────────────────────────────────────────────────────────────────────
Notes .....
■ If you're interested in writing "bullet-proof" batch files,
then I've also included an additional ERRORLEVEL which may be
of interest.
■ If a DOS level error (like file locked or file write-protected)
happens, THISTIME will set ERRORLEVEL 255 which may then be
tested and acted upon by your batch file.
─────────────────────────────────────────────────────────────────────────────
Author: Frederick Volking / Work: (415)378-4640 / Home: (415)952-3450
425 Larch Avenue - South San Francisco, California 94080
Compuserve - 72000,2337
─────────────────────────────────────────────────────────────────────────────
PUBLIC NOTICE: This utility is hereby placed into the Public Domain by
it's original author effective September 6th, 1991.
Enjoy ... Frederick
─────────────────────────────────────────────────────────────────────────────